package com.dinzeer.sjapadder.se;

import cn.mmf.slashblade_addon.SlashBladeAddon;
import cn.mmf.slashblade_addon.specialattacks.WaterDrive;

import com.dinzeer.sjapadder.register.SjaSpecialEffectRegsitry;
import mods.flammpfeil.slashblade.capability.slashblade.ISlashBladeState;
import mods.flammpfeil.slashblade.event.SlashBladeEvent;
import mods.flammpfeil.slashblade.registry.specialeffects.SpecialEffect;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber
public class Terrifyingwaves extends SpecialEffect {
    public Terrifyingwaves() {
        super(40,false,false);
    }
    @SubscribeEvent
    public static void onDoingSlash(SlashBladeEvent.DoSlashEvent event) {
        if(ModList.get().isLoaded(SlashBladeAddon.MODID)) {
        ISlashBladeState state = event.getSlashBladeState();
        if (state.hasSpecialEffect(SjaSpecialEffectRegsitry.TerrifyingWaves.getId())) {
            if (!(event.getUser() instanceof Player)) {

                WaterDrive.doSlash(event.getUser() , event.getRoll(),
                        20, Vec3.ZERO, false, event.getDamage() , 3F);
                return;
            }

            Player player = (Player)event.getUser();
            int level = player.experienceLevel;
            if (SpecialEffect.isEffective(SjaSpecialEffectRegsitry.TerrifyingWaves.get(), level)) {

                   WaterDrive.doSlash(player, event.getRoll(),
                           20, Vec3.ZERO, false, event.getDamage()+1, 3F);

            }
        }
        }
    }
}
